import chardet
import logging

def check_file_encoding(file_path):
    """
    增强版第一行编码检测，会验证常见编码
    """
    # 先用chardet检测
    with open(file_path, 'rb') as f:
        row_data = f.read(10000)
        detected = chardet.detect(row_data)
        encodings = detected['encoding']
        logging.info(f"文件:{file_path},编码格式:{encodings}")
        return encodings